from django.db import models

class Template(models.Model):
    name = models.CharField(max_length=100)
    type = models.CharField(max_length=50, default='', blank=True)
    note = models.TextField(blank=True)
    author = models.CharField(max_length=50)
    create_time = models.DateTimeField(auto_now_add=True)
    settings = models.JSONField(default=dict)

    class Meta:
        ordering = ['-create_time']

    def __str__(self):
        return self.name


# {
#   "experimentId": "",
#   "experimentName": "",
#   "timeRange": {
#     "start": "",
#     "end": ""
#   },
#   "channels": [
#     {
#       "id": 1,
#       "experimentId": "",
#       "channel": "",
#       "transform": "",
#       "unit": "",
#       "position": "",
#       "color": "#1890ff",
#       "enabled": true
#     }
#     // ... 更多通道
#   ]
# }